﻿<%@ Page Language="C#" EnableEventValidation="false" AutoEventWireup="true" CodeBehind="EditTravelGuide.aspx.cs" Inherits="DLV.BackEnd.Pages.EditTravelGuide" %>
<%@ Register Src="~/Controls/TinyMCE.ascx" TagPrefix="uc1" TagName="TinyMCE" %>

<asp:content id="Content1" contentplaceholderid="placeHolderContent" runat="server">
    <div id="toolbar-box">
		<div class="t">
			<div class="t">
				<div class="t"></div>
			</div>
		</div>
		<div class="m">
		    <div id="toolbar" class="toolbar">
			    <table class="toolbar">
			        <tbody>
					    <tr>
						    <td id="toolbar-save" class="button">
						        <asp:LinkButton ID="lbtSave" runat="server" Text="" onclick="lbtSave_Click" CssClass="toolbar">
					                <span id="Span1" title="Save" class="icon-32-save" runat="server"></span>Lưu
					            </asp:LinkButton>
						    </td>
						    <td id="toolbar-cancel" class="button">
						        <asp:LinkButton ID="lbtClose" runat="server" Text="" onclick="lbtClose_Click" 
                                    CssClass="toolbar" CausesValidation="False">
					                <span id="Span2" title="Close" class="icon-32-cancel" runat="server"></span>Thoát
					            </asp:LinkButton>
						    </td>
					    </tr>
				    </tbody>
			    </table>
		    </div>
			<div class="header">Thêm mới/chỉnh sửa hướng dẫn viên</div>
			<div class="clr"></div>
		</div>
		<div class="b">
			<div class="b">
				<div class="b"></div>
			</div>
		</div>
	</div>
	<div id="element-box">
		<div class="t">
			<div class="t">
				<div class="t"></div>
			</div>
		</div>
		<div class="m" style="float:left; width:100%">
			<div class="admin-left">
                <table class="adminform">
                    <tr>
                        <td style="width: 20%;">Tên nhân viên</td>
                        <td><asp:TextBox id="txtFullName" runat="server" Width="95%"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>Hình đại diện</td>
                        <td>                           
                            <span id="btnUploadSingle" class="upload-images button-gray">Tải hình ảnh lên</span>
                            <input type="file" id="fileUploadSingle" style="display: none;" class="hide" />
						</td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <div class="af-progress"><div class="af-progress-bar"></div></div>
						    <div class="upload-result">
						        <%=ThumbnailPreview %>
						    </div>
                            <input type="hidden" value="" class="thumbnailAvatar" name="thumbnailAvatar" id="thumbnailAvatar" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            Thông tin nhân viên
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <uc1:TinyMCE runat="server" ID="txtContent" />
                        </td>
                    </tr>
                </table>  
            </div>  
            <div class="admin-right">
                <table>
                    <tr>
						<td colspan="2">
                            <div id="ErorMessage" style="color: Red;line-height: 150%;"></div>
                        </td>
					</tr>
                    <tr>
                        <td style="width: 25%;">Ngày sinh: </td>
                        <td>
                            <input type="text" id="dteBirthday" placeholder="Click để chọn ngày" readonly="readonly" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>CMND: </td>
                        <td>
                            <asp:TextBox ID="txtIdentityCard" CssClass="validate-number" runat="server" Width="400px" />
                        </td>
                    </tr>
                    <tr>
                        <td>Giới tính</td>
                        <td>
                            <asp:DropDownList ID="ddlGender" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Số điện thoại: </td>
                        <td>
                            <asp:TextBox ID="txtPhone" CssClass="validate-number" runat="server" Width="400px" />
                        </td>
                    </tr>
                    
                    <tr>
                        <td>Email: </td>
                        <td>
                            <asp:TextBox ID="txtEmail" runat="server" Width="400px" />
                        </td>
                    </tr>
                     <tr>
                        <td>Facebook: </td>
                        <td>
                            <asp:TextBox ID="txtFacebook" runat="server" Width="400px" />
                        </td>
                    </tr>
                     <tr>
                        <td>Google Plus: </td>
                        <td>
                            <asp:TextBox ID="txtGooglePlus" runat="server" Width="400px" />
                        </td>
                    </tr>
                     <tr>
                        <td>Twitter: </td>
                        <td>
                            <asp:TextBox ID="txtTwitter" runat="server" Width="400px" />
                        </td>
                    </tr>
                    <tr>
                        <td>Trình độ: </td>
                        <td>
                            <asp:DropDownList ID="ddlLevel" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Loại tuyến: </td>
                        <td>
                            <asp:DropDownList ID="ddlTravelType" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Châu lục</td>
                        <td>
                            <asp:DropDownList ID="ddlContinent" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Quốc gia</td>
                        <td>
                            <asp:DropDownList ID="ddlNational" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Tỉnh/Thành phố</td>
                        <td>
                            <asp:DropDownList ID="ddlCity" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Quận/Huyện</td>
                        <td>
                            <asp:DropDownList ID="ddlDistrict" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Phường/Xã</td>
                        <td>
                            <asp:DropDownList ID="ddlWard" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Số nhà, đường: </td>
                        <td>
                            <asp:TextBox ID="txtAddress" runat="server" Width="400px" />
                        </td>
                    </tr>
                    <tr>
                        <td class="label">Ngôn&nbsp;ngữ:</td>
                        <td id="languages" style="text-align: left" >
                            <div>
                                <input type="text" onclick="openPopup('travel')" style="width:400px;" readonly="readonly" placeholder="Click để chọn ngôn ngữ" />
                            </div> 
                            <input type="hidden" id="txtLanguages" runat="server" value=""/>
                        </td>
                    </tr>
                    <tr>
                        <td>Tình trạng</td>
                        <td>
                            <asp:DropDownList ID="ddlStatus" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Người tạo</td>
                        <td>
                            <asp:DropDownList ID="ddlAdminUser" runat="server" Width="200px"></asp:DropDownList>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="clr"></div>
		</div>
		<div class="b">
			<div class="b">
				<div class="b"></div>
			</div>
		</div>
	</div>
    
    <!-- Danh sách món ăn-->
    <link href="/css/popup.css" rel="stylesheet" />
    <script src="/js/jquery.popup.js"></script>
    <div class="popup-wrapper"></div>
    <div class="popup-main popup-travel">
        <div class="popup-content">
            <div class="popup-close icon-close" onclick="closePopup('travel')"></div>
            <% foreach (DLV.Data.Entities.LanguageInfo info in LanguageList) { %>
            <div class="item">
                <input type="checkbox" name="ckss" value="<%=info.LanguageId %>">
                <span><%=info.LanguageName %></span>
            </div>
            <%} %> 
        </div>
    </div>
    
    <!-- Ngôn ngữ -->
    <script type="text/javascript">
        $(document).ready(function () {
            //đỗ dữ liệu vào các checkbox (check hay ko check)
            var arrUtility = $("#<%=txtLanguages.ClientID %>").val();
            var arr = arrUtility.split(",", 100);
            $("input[name='ckss']").each(function () {
                for (var i = 0; i < arr.length; i++) {
                    var x = $(this).val();
                    if (x == arr[i]) {
                        $(this).attr('checked', true);
                        break;
                    }
                }
            });
            //xử lý sự kiên check của checkobox
            $("[name='ckss']").change(function () {
                var str = "";
                $("input[name='ckss']:checked").each(function (i, val) {
                    if (str == "")
                        str += $(this).val();
                    else
                        str += "," + $(this).val();
                });

                $("#<%=txtLanguages.ClientID %>").val(str);
            });
        });
    </script>
    
    <!-- Load National, City, District, Ward -->
    <script src="/js/jquery.address.js"></script>
    <script type="text/javascript">
        var continentItem = $('#<%=ddlContinent.ClientID %>');
        var nationalItem = $('#<%=ddlNational.ClientID %>');
        var cityItem = $('#<%=ddlCity.ClientID %>');
        var districtItem = $('#<%=ddlDistrict.ClientID %>');
        var wardItem = $('#<%=ddlWard.ClientID %>');
        loadNational(continentItem, nationalItem, cityItem, districtItem, wardItem);
        loadCity(nationalItem, cityItem, districtItem, wardItem);
        loadDistrict(cityItem, districtItem, wardItem);
        loadWard(districtItem, wardItem);
    </script>
    
    <!-- Validate -->
    <script type="text/javascript">
        $(document).ready(function () {
            $("#<%= lbtSave.ClientID %>").click(function () {
                $("#ErorMessage").html('');
                
                var rtnValue = validate($("#<%= txtFullName.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập tên nhân viên<br\>")
                    && validate($("#<%= thumbnailAvatar.ClientID %>"), $("#ErorMessage"), "Vui lòng chọn hình đại diện<br\>")
                    && validate($("#<%= dteBirthday.ClientID %>"), $("#ErorMessage"), "Vui lòng chọn ngày sinh<br\>")
                    && validate($("#<%= txtIdentityCard.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập chứng minh nhân dân<br\>")
                    && validate($("#<%= txtPhone.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập số điện thoại<br\>")
                    && validate($("#<%= txtEmail.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập email<br\>")
                    && validate($("#<%= txtAddress.ClientID %>"), $("#ErorMessage"), "Vui lòng nhập địa chỉ<br\>")
                    && validate($("#<%= txtLanguages.ClientID %>"), $("#ErorMessage"), "Vui lòng chọn ngôn ngữ<br\>");

                if (jQuery.trim($("#<%= txtEmail.ClientID %>").val()) != "" && !validateEmail($("#<%= txtEmail.ClientID %>").val())) {
                    $("#ErorMessage").append("Email không đúng định dạng<br\>");
                    $("#<%= txtEmail.ClientID %>").addClass('has-error');
                    rtnValue = false;
                }
                
                return rtnValue;
            });
        });
    </script>
    <link rel="stylesheet" href="/css/datepicker/jquery.ui.all.css" />
	<script type="text/javascript" src="/js/ui/jquery.ui.core.js"></script>
	<script type="text/javascript" src="/js/ui/jquery.ui.datepicker.js"></script>
	<script type="text/javascript">
	    $(function () {
	        $("#<%= dteBirthday.ClientID %>").datepicker({
	            changeMonth: true,
	            changeYear: true,
	            dateFormat: "dd/mm/yy",
	            yearRange: '1900:c+1'
	        });
	    });
	</script>
</asp:content>
